package June;

public class Test_19_2 {
    public static void main(String[] args) {
        Dog dog1 = new Dog("king", "金色", 3);
        Dog dog2 = new Dog("tom", "黑色", 4);
        dog1.show();
        dog2.show();
    }
}

// 设计一个Dog类，
// 有名字、颜色和年龄属性，
// 定义输出方法show()显示其信息。
// 并创建对象，进行测试  [提示this.属性]
class Dog {
    String name;
    String color;
    int age;
    public Dog(String name, String color, int age) {
        this.name = name;
        this.color = color;
        this.age = age;
    }
    public void show() {
        System.out.println("狗的名字是：" + this.name + "\n" + "颜色是：" + this.color + "\n" + "年龄是：" + this.age);
    }
}